<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');
/**
 * CodeIgniter
 *
 * An open source application development framework for PHP 5.1.6 or newer
 *
 * @package		CodeIgniter
 * @author		ExpressionEngine Dev Team
 * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc.
 * @license		http://codeigniter.com/user_guide/license.html
 * @link		http://codeigniter.com
 * @since		Version 1.0
 * @filesource
 */
// ------------------------------------------------------------------------

/**
 * Parser Class
 *
 * @package		CodeIgniter
 * @subpackage	Libraries
 * @category	Parser
 * @author		ExpressionEngine Dev Team
 * @link		http://codeigniter.com/user_guide/libraries/parser.html
 */
class CMS_Parser extends CI_Parser {

    function __construct() {
        
    }

    /**
     *  Parse a template
     *
     * Parses pseudo-variables contained in the specified template view,
     * replacing them with the data in the second param
     *
     * @access	public
     * @param	string
     * @param	array
     * @param	bool
     * @return	string
     */
    public function parse_cms($template, $data, $return = FALSE) {

        $CI = &get_instance();
        $template = $CI->load->view($template, $data, TRUE);
        $CI->lang->load('defaut_view');
        $d = array();
        $d = $CI->lang->multi_line($d);
        $d['base_url'] = base_url();
        $d['base_cms'] = base_cms();
        $d['base_template'] = base_template();
        $d1['include_header_view'] = $this->parse('include_header_view', $d, TRUE);
        $d1['include_footer_view'] = $this->parse('include_footer_view', $d, TRUE);
        $d1['include_body_header_view'] = $this->parse('include_header_extra_view', $d, TRUE);
        $d1['include_body_menu_left_view'] = $this->parse('include_menu_left_view', $d, TRUE);
        foreach ($data as $k => $v) {
            $d[$k] = $v;
        }
        $da = array();
        $da = array_merge($d, $d1);
        return $this->_parse($template, $da, $return);
    }

}

// END Parser Class

/* End of file Parser.php */
/* Location: ./system/libraries/Parser.php */
